/**
 * Builds a breadcrumb within a specific element
 * @param element The element to build the breadcrumb within
 * @param object The base object of the current page
 */
function buildBreadCrumb(element, object){
	//Home link
	var breadcrumb = $('<div>').addClass('breadcrumb');
	
	//Home link
	var link = $('<a>').attr("href", "#").html("Home"); //TODO put in home link
	breadcrumb.append(link);
	
	var chain = [];
	
	var parent = object;
	while(parent != null){
		var linkInChain = $('<a>').attr("href", "#").html(parent.name);
		chain.push(linkInChain);
		parent = parent.parent;
	}
	
	for(var i = chain.length - 1; i >= 0; i--){
		breadcrumb.append(" &gt;&gt; ");
		breadcrumb.append(chain[i]);
	}
	
	$(element).append(breadcrumb);
}